package org.lex.swing.tab;

import javax.swing.JTabbedPane;

public class EnhancedTabPane extends JTabbedPane {
	public EnhancedTabPane() {
		super();
	}

	public EnhancedTabPane(int tabPlacement, int tabLayoutPolicy) {
		super(tabPlacement, tabLayoutPolicy);
	}

	public EnhancedTabPane(int tabPlacement) {
		super(tabPlacement);
	}

	/***************************************************************************
	 * 
	 **************************************************************************/
	public void addTab(Tab tab) {
		this.insertTab(this.getTabCount(), tab);
	}

	public void insertTab(int index, Tab tab) {
		if (tab instanceof TabbedPaneAccesser)
			((TabbedPaneAccesser) tab).setTabbedPane(this);
		super.insertTab(null, null, tab.getComponent(), null, index);
		super.setTabComponentAt(index, tab.getHeader());
	}
}
